package com.fzu.ess.ess.entity;

import com.fzu.ess.common.entity.BaseEntity;
import com.fzu.ess.sys.entity.User;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by ercha on 2015/10/24.
 */
@Entity
@Data
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="ess_report")
public class Report extends BaseEntity {
    public Report(){ super(); }

    public Report(String id){
        super();
        this.id = id;
    }

    @ManyToOne
    @JoinColumn(name="book_id")
    private Book book;             //被举报的书籍

    @ManyToOne
    @JoinColumn(name="informant_id")
    private User informant;             //举报人

    @JoinColumn(name="reason")
    private String reason;             //举报原因

    /**
     * 处理状态
     * 0：待处理
     * 1：正在处理
     * 2：已处理
     * 3：已撤销
     */
    @Column(name="status")
    private Integer status;

    @JoinColumn(name="result")
    private String result;              //处理结果，管理员填写

    @ManyToOne
    @JoinColumn(name="admin_id", nullable = true)
    private User admin;                 //最后处理的管理员的

    @Column(name="update_date")
    private Date updateDate;           //最后更新的时间
}
